package shanhai;

import entity.User;

import java.util.function.Consumer;

public class Test {
    public static void main(String[] args) {
        User user = new User(); // 创建
        Consumer<User> initConsumer = (t)->{ // 初始化对象
            t.setUserName("ask");
            t.setPassword(6666L);
            if (t.getId() == null)
                t.setId(1L);
            else t.setId(2L);
        };
        initConsumer.accept(user);
        System.out.println(user);
    }
}
